/**
 * 测试queue
 **/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include "../src/config.h"
#include "../src/queue.h"
#include "../src/factory.h"

int main(int argc, char* argv[])
{
    loadConfig("../conf/simq.conf");
    factoryCreate();

    printf("queue email:\n");
    factoryIn("email", "m@p58.net");
    factoryIn("email", "m@fcniu.com");
    printf(factoryOut("email"));
    printf("\n");
    printf(factoryOut("email"));
    printf("\n");

    printf("queue sms:\n");
    factoryIn("sms", "您好！短信第1条！");
    factoryIn("sms", "您好！短信第2条！");
    factoryIn("sms", "您好！短信第3条！");
    factoryIn("sms", "您好！短信第4条！");
    printf(factoryOut("sms"));
    printf("\n");
    printf(factoryOut("sms"));
    printf("\n");

    factoryDump();
    factoryFree();
    factoryCreate();
    factoryRestore();

    printf(factoryOut("sms"));
    printf("\n");
    printf(factoryOut("sms"));
    printf("\n");
    factoryFree();
    freeConfig();
}
